package cn.song.mq;

import org.springframework.amqp.rabbit.annotation.EnableRabbit;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.amqp.support.converter.MessageConverter;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

@EnableRabbit  //启用 RabbitMQ 自动配置
@SpringBootApplication
public class PulibsherApplication {
    public static void main(String[] args) {
        // 程序启动入口
        SpringApplication.run(PulibsherApplication.class, args);
    }


    /**
     * JSON 消息转换器
     *
     * @return 消息转换器
     */
    @Bean
    public MessageConverter jsonMessageConverter(){
        return new Jackson2JsonMessageConverter();
    }
}
